/*
 * @Author: CPS
 * @Date: 2020-06-08 23:39:03
 * @Last Modified by: CPS
 * @Last Modified time: 2020-06-13 11:50:44
 */
'use strict'
const path = require('path')
const webpack = require('webpack');
const webpackDevServer = require('webpack-dev-server');

const config = require(path.resolve(__dirname, './renderer.config.js')); //关联配置
const compiler = webpack(config);

console.log('****************' + config)
const tt = {
  contentBase: path.resolve(__dirname, '../build/'),
  host: '127.0.0.1',
  publicPath: path.resolve(__dirname, '../build/'),
  filename: 'index.html',
  compress: true,
};
console.log('****************' + tt.contentBase)

webpackDevServer.addDevServerEntrypoints(config, tt);

const server = new webpackDevServer(compiler, tt);

server.listen(5000, '127.0.0.1', (e) => {
  console.log('dev server listening on port 5000');
  if (e) {
    console.log(e)
  }
});